//2788.按分隔符拆分字符串
//https://leetcode.cn/problems/split-strings-by-separator/?envType=daily-question&envId=2024-01-20
class Solution {
public:
    vector<string> splitWordsBySeparator(vector<string>& words, char separator) {
        vector<string> ret;
        for(string& s:words)
        {
            int start = 0;
            int pos = s.find(separator,start);
            while(pos != string::npos)
            {
                if(pos-start) ret.push_back(s.substr(start,pos-start));
                start = pos+1;
                pos = s.find(separator,start);
            }
            if(start < s.size()) ret.push_back(s.substr(start));
        }
        return ret;
    }
};